<div class="generate-posters acea-row row-middle">
    <div class="item weixinShare">
        <div class="iconfont icon-weixin"></div>
        <div>
            发送给朋友
        </div>
    </div>
    <div class="item weixinHaibao">
        <div class="iconfont icon-haibao"></div>
        <div>
            生成海报
        </div>
    </div>
</div>
<div class="poster-first">
    <div class="mask-share">
        <img src="${request.contextPath}/web/images/share-info.png" />
    </div>
</div>
<div>
    <div class="haibao-first">
        <div class="textpic acea-row row-between-wrapper">
            <div class="text">
                <div class="line1">
                    生成商品海报
                </div>
            </div>
            <div class="iconfont icon-guanbi">
            </div>
        </div>
        <div class="cart">
            <div class="slider-banner product-bg" style="padding: 0 1.3rem;">
                <div class="swiper-container swiper-container-initialized swiper-container-horizontal swiper-container-ios" id="swiper-container2">
                    <div class="swiper-wrapper">
                        <!--<#if data.sliderImages??>-->
                        <!--<#list data.sliderImages as item>-->
                        <!--<div class="swiper-slide">-->
                        <!--<img src="${item}" class="slide-image">-->
                        <!--</div>-->
                        <!--</#list>-->
                        <!--</#if>-->
                    </div>
                    <div class="swiper-pagination"></div>
                </div>
            </div>
        </div>
        <div class="cart">
            <div class="line3">
                长按图片保存到手机后，您可分享该商品图片
            </div>
        </div>
    </div>
</div>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"></script>
<script>
var parentId = '${parentId!}';
$(function(){
        $.ajax({
                  type: 'GET',
                  url: '${request.contextPath}/web/goods/getShareImgs/${data.id!}/1',
                  dataType:'json',
                  contentType:'application/json',
                  success: function(data){
                    var imgs = data.data;
                    $("#swiper-container2 .swiper-wrapper").empty();
                    for(var i = 0; i < imgs.length; i++){
                        var html = '<div class="swiper-slide"><img src="'+imgs[i]+'" class="slide-image"></div>';
                        $("#swiper-container2 .swiper-wrapper").append(html);
                    }
                    new Swiper('#swiper-container2', {
                        direction: 'horizontal',
                        pagination: {
                            el: '.swiper-pagination',
                         }
                    });
                  }
        });
        if(parentId != '0'){
            $.ajax({
                  type: 'POST',
                  url: '${request.contextPath}/web/spread/add/'+parentId,
                  dataType:'json',
                  success: function(data){
                  }
            });
        }
        $('.icon-fenxiang').on('touchstart', function () {
            $('.mask').show();
            $('.generate-posters').addClass('on');
        })
        $('.weixinShare').on('touchstart', function () {
            $('.mask').show();
            $('.product-window').removeClass('on');
            $('.generate-posters').removeClass('on');
            $('.haibao-first').removeClass('on');
            $('.poster-first').addClass('on');
        })
        $('.weixinHaibao').on('touchstart', function () {
            $('.mask').show();
            $('.product-window').removeClass('on');
            $('.generate-posters').removeClass('on');
            $('.poster-first').removeClass('on');
            $('.haibao-first').addClass('on');
        })
        $('.mask-share img').on('touchstart', function () {
            $('.mask').hide();
            $('.product-window').removeClass('on');
            $('.generate-posters').removeClass('on');
            $('.poster-first').removeClass('on');
        })
         wx.config({
		    debug: false,
		    appId: '<#if share??>${share.appId}</#if>',
		    timestamp: '<#if share??>${share.timestamp}</#if>',
		    nonceStr: '<#if share??>${share.nonceStr}</#if>',
		    signature: '<#if share??>${share.signature}</#if>',
		    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
		});
		wx.ready(function(){
		    // 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
		    wx.onMenuShareTimeline({
		       title: '<#if share??>${share.title}</#if>', // 分享标题
		       desc: "<#if share??>${share.desc}</#if>", // 分享描述
		       link:"<#if share??>${share.link}</#if>",
		       imgUrl: "<#if share??>${share.imgUrl}</#if>" // 分享图标
		    });
		    // 获取“分享给朋友”按钮点击状态及自定义分享内容接口
		    wx.onMenuShareAppMessage({
               title: '<#if share??>${share.title}</#if>', // 分享标题
		       desc: "<#if share??>${share.desc}</#if>", // 分享描述
		       link:"<#if share??>${share.link}</#if>",
		       imgUrl: "<#if share??>${share.imgUrl}</#if>" // 分享图标
		    });
		});
});
</script>